package com.szsh.aiot.hsm.dto.gateway;

import org.apache.commons.lang3.StringUtils;

/**
 * 存放用户相关的网关信息
 */
public class IGatewayInfo {

    /*宽带账号*/
    private String broadbandNO;

    /*手机号码*/
    private String phone;

    /*mac*/
    private String mac;

    /*型号*/
    private String model;

    /*厂商*/
    private String vendor;

    /*中间件版本,其中倒数第二段为芯片型号*/
    private String middle;

    /*网关类型(OSGI表示1.0网关，CTWRT表示2.0网关，CTWRT3表示3.0网关)*/
    private String deviceOs;

    /*省份编码*/
    private String provice;

    /*城市编码*/
    private String city;

    /*区县编码*/
    private String area;

    private String chipModel;

    @Override
    public String toString() {
        return "IGatewayInfo{" +
                "broadbandNO='" + broadbandNO + '\'' +
                ", phone='" + phone + '\'' +
                ", mac='" + mac + '\'' +
                ", model='" + model + '\'' +
                ", vendor='" + vendor + '\'' +
                ", middle='" + middle + '\'' +
                ", deviceOs='" + deviceOs + '\'' +
                ", provice='" + provice + '\'' +
                ", city='" + city + '\'' +
                ", area='" + area + '\'' +
                '}';
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getBroadbandNO() {
        return broadbandNO;
    }

    public void setBroadbandNO(String broadbandNO) {
        this.broadbandNO = broadbandNO;
    }

    public String getMac() {
        return mac;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public String getVendor() {
        return vendor;
    }

    public void setVendor(String vendor) {
        this.vendor = vendor;
    }

    public String getMiddle() {
        return middle;
    }

    public void setMiddle(String middle) {
        this.middle = middle;
    }

    public String getDeviceOs() {
        return deviceOs;
    }

    public void setDeviceOs(String deviceOs) {
        this.deviceOs = deviceOs;
    }

    public String getProvice() {
        return provice;
    }

    public void setProvice(String provice) {
        this.provice = provice;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getChipModel() {
        if (StringUtils.isNotBlank(this.middle)) {
            // 不为空
            String[] gatewayMiddleString = this.middle.split("_");
            int index = gatewayMiddleString.length - 2;
            if (index >= 0) {
                // 索引大于 0
                this.chipModel = gatewayMiddleString[index];
            }
        }
        return this.chipModel;
    }

    public void setChipModel(String chipModel) {
        this.chipModel = chipModel;
    }

}
